package com.jishaokang.controller;

import com.jishaokang.base.Result;
import com.jishaokang.model.dto.Teacher;
import com.jishaokang.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;

/**
 * Created by NANA_Final on 2019/6/21.
 */
@RestController
@RequestMapping(value = "/api")
public class TeacherController {
    @Autowired
    private TeacherService teacherService;

    //--------------------------------------------------
    @RequestMapping(value = "/user/teacher/addTeacher",method = RequestMethod.POST)
    public Result addTeacher(@RequestBody Teacher teacher) throws ParseException {
        return teacherService.addTeacher(teacher);
    }

    @RequestMapping(value = "/teacher/teacher/selectTeacherByUserId",method = RequestMethod.POST)
    public Result selectTeacherByUserId(@RequestBody Teacher teacher) {
        return teacherService.selectTeacherByUserId(teacher);
    }

    @RequestMapping(value = "/teacher/teacher/updateTeacher",method = RequestMethod.POST)
    public Result updateTeacher(@RequestBody Teacher teacher) {
        return teacherService.updateTeacher(teacher);
    }

    //----------------------------------------------------

    @RequestMapping(value = "/admin/teacher/selectTeacher",method = RequestMethod.POST)
    public Result selectTeacher(@RequestBody Teacher teacher) {
        return teacherService.selectTeacher(teacher);
    }

    @RequestMapping(value = "/admin/teacher/selectTeacherByTeacherNameVague",method = RequestMethod.POST)
    public Result selectTeacherByTeacherNameVague(@RequestBody Teacher teacher) {
        return teacherService.selectTeacherByTeacherNameVague(teacher);
    }

    @RequestMapping(value = "/admin/teacher/updateTeacherCostPercent",method = RequestMethod.POST)
    public Result updateTeacherCostPercent(@RequestBody Teacher teacher) {
        return teacherService.updateTeacherCostPercent(teacher);
    }

}